package com.training.java.core.collection.post15;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class ListDemo {

	public static void main(String[] args) {
		
      List<String> list = new ArrayList<String>();
      list.add("Ram");
      list.add("Alams");
      list.add("Henry");
      list.add("Mira");
      list.add("Sam");
      
      Iterator<String> ite = list.iterator();
      
		while(ite.hasNext())
		{
			String studentName = ite.next();
			System.out.println("Student name = " + studentName);
		}
		
		System.out.println("-------------------------");
		
	  for(String studentName: list)
	  {
		  System.out.println("Student name = " + studentName);  
	  }
	}

}
